ÄúµÄλÖãºÑ°ÃÎÍøÊ×Ò³£¾±à³ÌÀÖÔ°£¾VBScript£¾VBScript


objects constants operators statements functions properties methods







Property:  Err.Source

object.Source [ = string]

This property lets us determine the object or application that caused an error, and returns a string that contains it's Class name or programmatic ID. Also used when generating errors in your code to identify your application as the source, using the optional [ = string] argument, as below.

Code:
On Error Resume Next
Err.Raise 8    'raise a user-defined error
Err.Description = "My Error"
Err.Source = "MyAppName"
Response.Write "An Error of the type '" & Err.Description & "' has been_
                         caused by '" & Err.Source & "'."

Output:
"An Error of the type 'My Error' has caused by 'MyAppName'."